<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:s="http://jboss.com/products/seam/taglib"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:a4j="http://richfaces.org/a4j">

	<rich:modalPanel id="editDlg" minWidth="450" minHeight="200" zindex="15500">
		<f:facet name="header">
			<h:outputText value="Agregar Material de Construccion" />
		</f:facet>

		<f:facet name="controls">
			<h:panelGroup>
				<h:graphicImage id="hideEditDlg" value="/img/close.png"
					styleClass="hidelink" />
				<rich:componentControl for="editDlg"
					attachTo="hideEditDlg" operation="hide" event="onclick" />
			</h:panelGroup>
		</f:facet>
		
		<h:form id="frmEditEntity">
			<div align="center">
				<h:panelGroup rendered="#{buildingMaterialHelper.selected != null}">
					<h:panelGrid columns="2" width="100%">
						<h:outputText value="Nombre: " />
						<h:inputText value="#{buildingMaterialHelper.selected.name}"
							readonly="#{not buildingMaterialHelper.editing}" required="true"
							style="width:100%"
							label="button.ok">
						</h:inputText>
	
						<h:outputText value="Descripcion: " />
						<h:inputTextarea value="#{buildingMaterialHelper.selected.description}"
							style="width:100%" rows="3"
							readonly="#{not buildingMaterialHelper.editing}">
						</h:inputTextarea>
					</h:panelGrid>
				</h:panelGroup>

				<br />
				<br />

				<h:panelGroup rendered="#{buildingMaterialHelper.editing}">
					<a4j:commandButton value="#{messages['button.ok']}"
						action="#{buildingMaterialHelper.saveSelected}"
						reRender="frmGrid"
						oncomplete="if (#{facesContext.maximumSeverity == null}) #{rich:component('editDlg')}.hide(); else #{rich:component('msgPanel')}.show();">
					</a4j:commandButton>
					<button
						onclick="#{rich:component('editDlg')}.hide();"
						type="button">
						#{messages['button.cancel']}
					</button>
				</h:panelGroup>
				<h:panelGroup rendered="#{not buildingMaterialHelper.editing}">
					<button
						onclick="#{rich:component('editDlg')}.hide();"
						type="button">
						#{messages['button.ok']}
					</button>
				</h:panelGroup>
			</div>
		</h:form>
	</rich:modalPanel>

</ui:composition>
